import java.util.Arrays;

/**
 * @author LKQ
 * @date 2022/1/7 19:31
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }

}

class NumArray {
    private int length;
    private int[] arr;
    public NumArray(int[] nums) {
        this.length = nums.length;
        this.arr = new int[length];
        System.arraycopy(nums, 0, arr, 0, length);
    }

    public int sumRange(int left, int right) {
        int ans = 0;
        for (int i = left; i <=right; i++) {
            // 每一次都要检索arr, 耗时
            ans += arr[i];
        }
        return ans;
    }
}
